[root@gitlab remote-develop]# cat Dockerfile 
# 使用 ubuntu:24.10 作为基础镜像
FROM base.troila.com:9000/library/ubuntu:22.04

# 设置工作目录
WORKDIR /workspace

# 设置识趣
ENV TZ=Asia/Shanghai
# 设置CEPH版本
ENV CEPH_VERSION=18.2.2
# 设置GO的版本
ENV GO_VERSION=1.23.7
# 设置SSH密码
ENV SSH_PASSWORD=troila@123
# 设置GO环境变量
ENV PATH="$PATH:/usr/local/go/bin"

# 复制已经下载的go环境文件
COPY go${GO_VERSION}.linux-amd64.tar.gz /workspace

# 更新包索引并安装必要工具, 容器中创建go相关的文件夹, 开启ssh远程连接
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    apt-get update && \
    apt-get install -y --no-install-recommends wget curl vim openssh-server ca-certificates postgresql-client software-properties-common tzdata && \
    mkdir -p /etc/apt/keyrings && \
    dpkg-reconfigure --frontend noninteractive tzdata && \
    wget -q -O- 'https://download.ceph.com/keys/release.asc' | gpg --dearmor -o /etc/apt/keyrings/ceph.gpg && \
    echo "deb [signed-by=/etc/apt/keyrings/ceph.gpg] https://download.ceph.com/debian-${CEPH_VERSION}/ $( . /etc/os-release && echo $VERSION_CODENAME) main" | tee /etc/apt/sources.list.d/ceph.list && \
    apt-get update && \
    apt-get install -y ceph libcephfs-dev librados-dev librbd-dev gcc g++ && \
    apt-get clean && \
    mkdir -p /workspace/src && \
    mkdir -p /workspace/pkg && \
    mkdir -p /workspace/bin && \
    mkdir -p /workspace/env && \
    echo "root:${SSH_PASSWORD}" | chpasswd && \
    sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config && \
    sed -i "s/#PasswordAuthentication yes/PasswordAuthentication yes/" /etc/ssh/sshd_config && \
    rm -rf /var/lib/apt/lists/*

# 安装并配置GO环境
RUN tar -C /usr/local -xzf /workspace/go${GO_VERSION}.linux-amd64.tar.gz && rm go${GO_VERSION}.linux-amd64.tar.gz && \
    go env -w GO111MODULE=on && \
    go env -w GOPROXY=https://goproxy.cn,direct && \
    go env -w GOPATH=/workspace && \
    echo "export PATH=$PATH:/usr/local/go/bin:/workspace/bin" >> /etc/profile && \
    echo "export GOPATH=/workspace" >> /etc/profile && \
    go install github.com/swaggo/swag/cmd/swag@latest && \
    go install github.com/zxmfke/swagger2openapi3/cmd/swag2op@latest

# 默认命令
CMD ["/bin/bash", "-c", "service ssh start && bash"]
